package com.daasuu.sample;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import java.util.Random;


public class ShowActivity extends Activity {

    private Button button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.show);
        Intent intent=new Intent();
        TextView showRandomXinTV=(TextView) findViewById(R.id.showRandomXin);
        TextView showRandomXueTV1=(TextView) findViewById(R.id.showRandomXue1);
        TextView showRandomXueTV2=(TextView) findViewById(R.id.showRandomXue2);
        TextView showRandomHuTV=(TextView) findViewById(R.id.showRandomHu);
        int showRandomXinRM = new Random().nextInt(100-60+1)+60;
        int showRandomHuRM = new Random().nextInt(20-16+1)+16;
        int showRandomXue1 = new Random().nextInt(140-90+1)+90;
        int showRandomXue2 = new Random().nextInt(90-60+1)+60;

        showRandomXinTV.setText(showRandomXinRM+"次/分钟");
        showRandomHuTV.setText(showRandomHuRM+"次/分钟");
        showRandomXueTV1.setText("收缩压(mmHg):"+showRandomXue1);
        showRandomXueTV2.setText("舒张压(mmHg):"+showRandomXue2);
        initViews();
    }

    private void initViews() {
        button = (Button) findViewById(R.id.show_button);
        button.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {


                // TODO Auto-generated method stub

                Intent intent=new Intent();

                //Intent可以在不同的应用程序的Activity发送数据

                intent.putExtra("testIntent", "Robin");

                intent.setClass(ShowActivity.this, PortrateActivity.class);//从哪里跳到哪里

                ShowActivity.this.startActivity(intent);
            }
        });
    }

}
